package com.zzl.bonds.ticket.dto.ticketopen;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.zzl.apidoc.annotation.ApidocModel;
import com.zzl.apidoc.annotation.ApidocModelProperty;
import com.zzl.bonds.ticket.constant.type.PaymentModeEnum;
import com.zzl.bonds.ticket.dto.ApUserShowInfo;
import com.zzl.bonds.ticket.entity.BusinessContractEntity;
import com.zzl.bonds.ticket.entity.TicketCirculationEnterpriseEntity;
import com.zzl.bonds.ticket.entity.TicketDataEntity;
import com.zzl.general.common.utils.DoubleSerialize;
import lombok.Data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author : spp
 * @date : 2022/2/18 20:29
 */
@Data
@ApidocModel
public class OpenDetailDto {

    @ApidocModelProperty(description = "主键 uuid")
    private String id;
    //    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
//    @ApidocModelProperty(description = "复核时间")
//    private Date reviewTime;
    @ApidocModelProperty(description = "凭证编号")
    private String ticketNo;
    @ApidocModelProperty(description = "处理状态")
    private String handStatus;
    @ApidocModelProperty(description = "处理状态信息悬浮")
    private String handStatusInfo;
    @ApidocModelProperty(description = "处理进度，如2/4")
    private Integer handProgress;

    @ApidocModelProperty(description = "开单企业id")
    private String openEnterpriseId;
    @ApidocModelProperty(description = "开单企业")
    private String openEnterpriseName;
    @ApidocModelProperty(description = "开单企业统一社会信用代码")
    private String openSocialCreditCode;
    @ApidocModelProperty(description = "收单企业id")
    private String receiveEnterpriseId;
    @ApidocModelProperty(description = "收单企业")
    private String receiveEnterpriseName;
    @ApidocModelProperty(description = "收单企业统一社会信用代码")
    private String receiveSocialCreditCode;
    @ApidocModelProperty(description = "授信id")
    private String coreEnterpriseCreditId;
    @ApidocModelProperty(description = "开单额度")
    private String creditUseInfo;
    @JsonSerialize(using = DoubleSerialize.class)
    @ApidocModelProperty(description = "凭证金额")
    private Double ticketAmount;
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApidocModelProperty(description = "开单日期", validate = "yyyy-MM-dd")
    private Date invoiceTime;
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApidocModelProperty(description = "到期日期", validate = "yyyy-MM-dd")
    private Date expireTime;
    @ApidocModelProperty(description = "付息方式 ：1 融资方付息（默认）2 核心企业付息")
    private Integer paymentMode;
    @ApidocModelProperty(description = "付息方式 ：1 融资方付息（默认）2 核心企业付息")
    private String paymentModeName;
    @ApidocModelProperty(description = "是否指定流转企业")
    private Integer circulationEnterpriseFlag;
    public String getPaymentModeName() {
        if (null != paymentMode) {
            return PaymentModeEnum.getValue(paymentMode);
        }
        return "";
    }
    @JsonIgnore
    private Integer ticketStatus;
    @ApidocModelProperty(description = "流转企业")
    private List<TicketCirculationEnterpriseEntity> circulationEnterprise;
    @ApidocModelProperty(description = "备注")
    private String remark;
    @ApidocModelProperty(description = "剩余天数")
    private String surplusDays;

    @ApidocModelProperty(description = "交易合同号")
    private String contractNo;

    @ApidocModelProperty(description = "发票信息")
    List<TicketDataEntity> invoiceList = new ArrayList<>();
    @ApidocModelProperty(description = "贸易合同")
    List<TicketDataEntity> proofList = new ArrayList<>();
    @ApidocModelProperty(description = "签署资料")
    List<BusinessContractEntity> protocolList;
    @JsonIgnore
    private Integer approveStatus;
    @ApidocModelProperty(description = "流转企业集合")
    private List<TicketCirculationEnterpriseEntity> circulationEnterpriseList;

    @ApidocModelProperty(description = "流程进度")
    List<ApUserShowInfo> apUserShowInfos;

}
